<!DOCTYPE html>
<!-- saved from url=(0047)https://www.cnblogs.com/xiaowuyi/p/3343757.html -->
<html lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="origin">
    <meta property="og:description" content="转载请注明：@小五义 http://www.cnblogs.com/xiaowuyi 欢迎加入讨论群&amp;#160;64770604 一、本次实验所需器材 1、Arduino板&amp;#160;https://">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园</title>
    
    <link rel="stylesheet" href="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/blog-common.min.css">
    <link id="MainCss" rel="stylesheet" href="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/bundle-simpleblue.min.css">
    
    <link id="mobile-style" media="only screen and (max-width: 767px)" type="text/css" rel="stylesheet" href="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/bundle-simpleblue-mobile.min.css">
    
    <link type="application/rss+xml" rel="alternate" href="https://www.cnblogs.com/xiaowuyi/rss">
    <link type="application/rsd+xml" rel="EditURI" href="https://www.cnblogs.com/xiaowuyi/rsd.xml">
    <link type="application/wlwmanifest+xml" rel="wlwmanifest" href="https://www.cnblogs.com/xiaowuyi/wlwmanifest.xml">
    <script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/amp4ads-host-v0.js.下载"></script><script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/pubads_impl_rendering_2019112101.js.下载"></script><script async="" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/analytics.js.下载"></script><script type="text/javascript" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/encoder.js.下载"></script><script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/jquery-2.2.0.min.js.下载"></script>
    <script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/blog-common.min.js.下载"></script>
    <script>
        var currentBlogId = 111015;
        var currentBlogApp = 'xiaowuyi';
        var cb_enable_mathjax = false;
        var isLogined = false;
    </script>
    
    
    
<link rel="preload" href="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/f.txt" as="script"><script type="text/javascript" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/f.txt"></script><script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/pubads_impl_2019112101.js.下载" async=""></script><link rel="prefetch" href="https://tpc.googlesyndication.com/safeframe/1-0-37/html/container.html"></head>
<body>
    <a name="top"></a>
    
    <div id="home">
    <div id="header">
        <div id="blogTitle">
            
<div class="title"><a id="Header1_HeaderTitle" class="headermaintitle HeaderMainTitle" href="https://www.cnblogs.com/xiaowuyi/">小五义</a>
</div>
<div class="subtitle">

</div>

        </div>
        <div id="navigator">
            
<ul id="navList">
    <li id="nav_sitehome"><a id="blog_nav_sitehome" class="menu" href="https://www.cnblogs.com/">
博客园</a>
</li>
    <li id="nav_myhome">
<a id="blog_nav_myhome" class="menu" href="https://www.cnblogs.com/xiaowuyi/">
首页</a>
</li>
    <li id="nav_newpost">

<a id="blog_nav_newpost" class="menu" href="https://i.cnblogs.com/EditPosts.aspx?opt=1">
新随笔</a>
</li>
    <li id="nav_contact">
<a id="blog_nav_contact" class="menu" href="https://msg.cnblogs.com/send/%E5%B0%8F%E4%BA%94%E4%B9%89">
联系</a></li>
    <li id="nav_rss">
<a id="blog_nav_rss" class="menu" href="https://www.cnblogs.com/xiaowuyi/rss/">
订阅</a></li>
    <li id="nav_admin">
<a id="blog_nav_admin" class="menu" href="https://i.cnblogs.com/">
管理</a>
</li>
</ul>

            <div class="blogStats">
                
<span id="stats_post_count">随笔 - 
147&nbsp;</span>
<span id="stats_article_count">文章 - 
13&nbsp;</span>
<!-- <span id="stats-comment_count"></span> -->
<span id="stats_comment_count">评论 - 
457</span>
            </div>
        </div>
    </div>
    <div id="main">
        <div id="mainContent">
            <div class="forFlow">
                <div id="post_detail">
    <div id="topics">
        <div class="post">
            <h1 class="postTitle">
                
<a id="cb_post_title_url" class="postTitle2" href="https://www.cnblogs.com/xiaowuyi/p/3343757.html">Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁</a>

            </h1>
            <div class="clear"></div>
            <div class="postBody">
                
<div id="cnblogs_post_body" class="blogpost-body ">
    <p>转载请注明：@小五义 <a href="http://www.cnblogs.com/xiaowuyi">http://www.cnblogs.com/xiaowuyi</a></p>
<p>欢迎加入讨论群&nbsp;<span id="group_number" class="group_number">64770604</span></p>
<h2>一、本次实验所需器材</h2>
<p>1、Arduino板&nbsp;https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-15820725129.16.AtgoEm&amp;id=545093340395</p>
<p>2、无源蜂鸣器：一种一体化结构的电子讯响器，分为有源蜂鸣器与无源蜂鸣器。这里的“源”不是指电源，而是指震荡源，有源蜂鸣器内部带震荡源，所以只要一通电就会响，而无源内部不带震荡源，所以如果仅用直流信号无法令其鸣叫，必须用2K-5K的方波去驱动它。从外观上看，两种蜂鸣器区别不大，但将两种蜂鸣器的引脚都朝上放置时，可以看出有绿色电路板的一种是无源蜂鸣器，没有电路板而用黑胶封闭的一种是有源蜂鸣器。如图：</p>
<p><a href="https://images0.cnblogs.com/blog/383503/201309/27231632-92e787c178074aebae65f9884239ec86.jpg"><img style="display: inline; border: 0px;" title="youwuyuan" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/27231633-f66aa9f440d54fd9b089f6a203f7ca6c.jpg" alt="youwuyuan" width="317" height="200" border="0"></a></p>
<p>3、LED：一个</p>
<p>4、杜邦线：若干</p>
<p>5、面包板：一个</p>
<h2>二、无源蜂鸣器发声实验</h2>
<p>&nbsp;&nbsp;&nbsp; 通过上网查询参数，得到其工作电压为5V，和arduino控制板数字端口输出电压一致，所以不需要接电阻，于是其与arduino的布线图和原理图如下：</p>
<p>&nbsp;&nbsp;&nbsp; <a href="https://images0.cnblogs.com/blog/383503/201309/27231633-7f4ea3232c884bfabe56d9b0dd8e2597.jpg"><img style="display: inline; border: 0px;" title="buxian" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/27231634-a625ed69690b49b798c67890d7764e09.jpg" alt="buxian" width="296" height="295" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://images0.cnblogs.com/blog/383503/201309/27231635-a71a61d462e946edbd394e5fab76c68a.jpg"><img style="display: inline; border: 0px;" title="yuanli" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/27231635-7ab2d48589fe425e9da7303e3a79d7d7.jpg" alt="yuanli" width="283" height="291" border="0"></a></p>
<p>&nbsp;</p>
<p>把下面的代码上传到arduino控制板上：</p>
<div class="cnblogs_code" style="background-color: #f5f5f5; border: #cccccc 1px solid; padding: 5px;"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #0000ff;">int</span>  tonepin=<span style="color: #800080;">6</span>;<span style="color: #008000;">//</span><span style="color: #008000;">设置控制蜂鸣器的数字6脚</span>
    <span style="color: #0000ff;">void</span><span style="color: #000000;"> setup()
    {
      pinMode(tonepin,OUTPUT);</span><span style="color: #008000;">//</span><span style="color: #008000;">设置数字IO脚模式，OUTPUT为输出</span>
<span style="color: #000000;">    }
    </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> loop()
    {
      unsigned </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> i,j;
      </span><span style="color: #0000ff;">while</span>(<span style="color: #800080;">1</span><span style="color: #000000;">)
      {
        </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">0</span>;i&lt;<span style="color: #800080;">80</span>;i++)<span style="color: #008000;">//</span><span style="color: #008000;">输出一个频率的声音</span>
<span style="color: #000000;">        {
          digitalWrite(tonepin,HIGH);</span><span style="color: #008000;">//</span><span style="color: #008000;">发声音</span>
          delay(<span style="color: #800080;">1</span>);<span style="color: #008000;">//</span><span style="color: #008000;">延时1ms</span>
          digitalWrite(tonepin,LOW);<span style="color: #008000;">//</span><span style="color: #008000;">不发声音</span>
          delay(<span style="color: #800080;">1</span>);<span style="color: #008000;">//</span><span style="color: #008000;">延时ms</span>
<span style="color: #000000;">        }
        </span><span style="color: #0000ff;">for</span>(i=<span style="color: #800080;">0</span>;i&lt;<span style="color: #800080;">100</span>;i++)<span style="color: #008000;">//</span><span style="color: #008000;">输出另一个频率的声音,这里的100与前面的80一样，用来控制频率，可以自己调节</span>
<span style="color: #000000;">        {
          digitalWrite(tonepin,HIGH);
          delay(</span><span style="color: #800080;">2</span><span style="color: #000000;">);
          digitalWrite(tonepin,LOW);
          delay(</span><span style="color: #800080;">2</span><span style="color: #000000;">);
        }
      }
    }</span></pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>从上面的代码可以看出，for语句中的80、100控制了频率，delay控制了时长，类似与音乐中的节拍。</p>
<p>实验视频如下：</p>
<p>&nbsp;<object width="320" height="240" data="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/v.swf.下载" type="application/x-shockwave-flash"><param name="src" value="http://player.youku.com/player.php/sid/XNjE0NDc5Nzg0/v.swf"></object></p>
<h2>三、无线蜂鸣器演奏音乐</h2>
<p>&nbsp;&nbsp;&nbsp; 从上面的实验看，如果我们能够控制好频率和节拍，那就有可能演奏出动听的音乐。因此，我们首先需要搞清楚各音调的频率，具体见下表：</p>
<p>低音：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="71">
<p>音调</p>
<p>音符</p>
</td>
<td valign="top" width="71">
<p>1<sub>#</sub></p>
</td>
<td valign="top" width="71">
<p>2<sub>#</sub></p>
</td>
<td valign="top" width="71">
<p>3<sub>#</sub></p>
</td>
<td valign="top" width="71">
<p>4<sub>#</sub></p>
</td>
<td valign="top" width="71">
<p>5<sub>#</sub></p>
</td>
<td valign="top" width="71">
<p>6<sub>#</sub></p>
</td>
<td valign="top" width="71">
<p>7<sub>#</sub></p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>A</p>
</td>
<td valign="top" width="71">
<p>221</p>
</td>
<td valign="top" width="71">
<p>248</p>
</td>
<td valign="top" width="71">
<p>278</p>
</td>
<td valign="top" width="71">
<p>294</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
<td valign="top" width="71">
<p>371</p>
</td>
<td valign="top" width="71">
<p>416</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>B</p>
</td>
<td valign="top" width="71">
<p>248</p>
</td>
<td valign="top" width="71">
<p>278</p>
</td>
<td valign="top" width="71">
<p>294</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
<td valign="top" width="71">
<p>371</p>
</td>
<td valign="top" width="71">
<p>416</p>
</td>
<td valign="top" width="71">
<p>467</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>C</p>
</td>
<td valign="top" width="71">
<p>131</p>
</td>
<td valign="top" width="71">
<p>147</p>
</td>
<td valign="top" width="71">
<p>165</p>
</td>
<td valign="top" width="71">
<p>175</p>
</td>
<td valign="top" width="71">
<p>196</p>
</td>
<td valign="top" width="71">
<p>221</p>
</td>
<td valign="top" width="71">
<p>248</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>D</p>
</td>
<td valign="top" width="71">
<p>147</p>
</td>
<td valign="top" width="71">
<p>165</p>
</td>
<td valign="top" width="71">
<p>175</p>
</td>
<td valign="top" width="71">
<p>196</p>
</td>
<td valign="top" width="71">
<p>221</p>
</td>
<td valign="top" width="71">
<p>248</p>
</td>
<td valign="top" width="71">
<p>278</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>E</p>
</td>
<td valign="top" width="71">
<p>165</p>
</td>
<td valign="top" width="71">
<p>175</p>
</td>
<td valign="top" width="71">
<p>196</p>
</td>
<td valign="top" width="71">
<p>221</p>
</td>
<td valign="top" width="71">
<p>248</p>
</td>
<td valign="top" width="71">
<p>278</p>
</td>
<td valign="top" width="71">
<p>312</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>F</p>
</td>
<td valign="top" width="71">
<p>175</p>
</td>
<td valign="top" width="71">
<p>196</p>
</td>
<td valign="top" width="71">
<p>221</p>
</td>
<td valign="top" width="71">
<p>234</p>
</td>
<td valign="top" width="71">
<p>262</p>
</td>
<td valign="top" width="71">
<p>294</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>G</p>
</td>
<td valign="top" width="71">
<p>196</p>
</td>
<td valign="top" width="71">
<p>221</p>
</td>
<td valign="top" width="71">
<p>234</p>
</td>
<td valign="top" width="71">
<p>262</p>
</td>
<td valign="top" width="71">
<p>294</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
<td valign="top" width="71">
<p>371</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>中音：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="71">
<p>音调</p>
<p>音符</p>
</td>
<td valign="top" width="71">
<p>1</p>
</td>
<td valign="top" width="71">
<p>2</p>
</td>
<td valign="top" width="71">
<p>3</p>
</td>
<td valign="top" width="71">
<p>4</p>
</td>
<td valign="top" width="71">
<p>5</p>
</td>
<td valign="top" width="71">
<p>6</p>
</td>
<td valign="top" width="71">
<p>7</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>A</p>
</td>
<td valign="top" width="71">
<p>441</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
<td valign="top" width="71">
<p>556</p>
</td>
<td valign="top" width="71">
<p>589</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
<td valign="top" width="71">
<p>742</p>
</td>
<td valign="top" width="71">
<p>833</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>B</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
<td valign="top" width="71">
<p>556</p>
</td>
<td valign="top" width="71">
<p>624</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
<td valign="top" width="71">
<p>742</p>
</td>
<td valign="top" width="71">
<p>833</p>
</td>
<td valign="top" width="71">
<p>935</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>C</p>
</td>
<td valign="top" width="71">
<p>262</p>
</td>
<td valign="top" width="71">
<p>294</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
<td valign="top" width="71">
<p>350</p>
</td>
<td valign="top" width="71">
<p>393</p>
</td>
<td valign="top" width="71">
<p>441</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>D</p>
</td>
<td valign="top" width="71">
<p>294</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
<td valign="top" width="71">
<p>350</p>
</td>
<td valign="top" width="71">
<p>393</p>
</td>
<td valign="top" width="71">
<p>441</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
<td valign="top" width="71">
<p>556</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>E</p>
</td>
<td valign="top" width="71">
<p>330</p>
</td>
<td valign="top" width="71">
<p>350</p>
</td>
<td valign="top" width="71">
<p>393</p>
</td>
<td valign="top" width="71">
<p>441</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
<td valign="top" width="71">
<p>556</p>
</td>
<td valign="top" width="71">
<p>624</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>F</p>
</td>
<td valign="top" width="71">
<p>350</p>
</td>
<td valign="top" width="71">
<p>393</p>
</td>
<td valign="top" width="71">
<p>441</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
<td valign="top" width="71">
<p>556</p>
</td>
<td valign="top" width="71">
<p>624</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>G</p>
</td>
<td valign="top" width="71">
<p>393</p>
</td>
<td valign="top" width="71">
<p>441</p>
</td>
<td valign="top" width="71">
<p>495</p>
</td>
<td valign="top" width="71">
<p>556</p>
</td>
<td valign="top" width="71">
<p>624</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
<td valign="top" width="71">
<p>742</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>高音：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="71">
<p>音调</p>
<p>音符</p>
</td>
<td valign="top" width="71">
<p>1<sup>#</sup></p>
</td>
<td valign="top" width="71">
<p>2<sup>#</sup></p>
</td>
<td valign="top" width="71">
<p>3<sup>#</sup></p>
</td>
<td valign="top" width="71">
<p>4<sup>#</sup></p>
</td>
<td valign="top" width="71">
<p>5<sup>#</sup></p>
</td>
<td valign="top" width="71">
<p>6<sup>#</sup></p>
</td>
<td valign="top" width="71">
<p>7<sup>#</sup></p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>A</p>
</td>
<td valign="top" width="71">
<p>882</p>
</td>
<td valign="top" width="71">
<p>990</p>
</td>
<td valign="top" width="71">
<p>1112</p>
</td>
<td valign="top" width="71">
<p>1178</p>
</td>
<td valign="top" width="71">
<p>1322</p>
</td>
<td valign="top" width="71">
<p>1484</p>
</td>
<td valign="top" width="71">
<p>1665</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>B</p>
</td>
<td valign="top" width="71">
<p>990</p>
</td>
<td valign="top" width="71">
<p>1112</p>
</td>
<td valign="top" width="71">
<p>1178</p>
</td>
<td valign="top" width="71">
<p>1322</p>
</td>
<td valign="top" width="71">
<p>1484</p>
</td>
<td valign="top" width="71">
<p>1665</p>
</td>
<td valign="top" width="71">
<p>1869</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>C</p>
</td>
<td valign="top" width="71">
<p>525</p>
</td>
<td valign="top" width="71">
<p>589</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
<td valign="top" width="71">
<p>700</p>
</td>
<td valign="top" width="71">
<p>786</p>
</td>
<td valign="top" width="71">
<p>882</p>
</td>
<td valign="top" width="71">
<p>990</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>D</p>
</td>
<td valign="top" width="71">
<p>589</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
<td valign="top" width="71">
<p>700</p>
</td>
<td valign="top" width="71">
<p>786</p>
</td>
<td valign="top" width="71">
<p>882</p>
</td>
<td valign="top" width="71">
<p>990</p>
</td>
<td valign="top" width="71">
<p>1112</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>E</p>
</td>
<td valign="top" width="71">
<p>661</p>
</td>
<td valign="top" width="71">
<p>700</p>
</td>
<td valign="top" width="71">
<p>786</p>
</td>
<td valign="top" width="71">
<p>882</p>
</td>
<td valign="top" width="71">
<p>990</p>
</td>
<td valign="top" width="71">
<p>1112</p>
</td>
<td valign="top" width="71">
<p>1248</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>F</p>
</td>
<td valign="top" width="71">
<p>700</p>
</td>
<td valign="top" width="71">
<p>786</p>
</td>
<td valign="top" width="71">
<p>882</p>
</td>
<td valign="top" width="71">
<p>935</p>
</td>
<td valign="top" width="71">
<p>1049</p>
</td>
<td valign="top" width="71">
<p>1178</p>
</td>
<td valign="top" width="71">
<p>1322</p>
</td>
</tr>
<tr>
<td valign="top" width="71">
<p>G</p>
</td>
<td valign="top" width="71">
<p>786</p>
</td>
<td valign="top" width="71">
<p>882</p>
</td>
<td valign="top" width="71">
<p>990</p>
</td>
<td valign="top" width="71">
<p>1049</p>
</td>
<td valign="top" width="71">
<p>1178</p>
</td>
<td valign="top" width="71">
<p>1322</p>
</td>
<td valign="top" width="71">
<p>1484</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>我们知道了音调的频率后，下一步就是控制音符的演奏时间。每个音符都会播放一定的时间，这样才能构成一首优美的曲子，而不是生硬的一个调的把所有的音符一股脑的都播放出来。音符节奏分为一拍、半拍、1/4拍、1/8拍，我们规定一拍音符的时间为1；半拍为0.5；1/4拍为0.25；1/8拍为0.125……，所以我们可以为每个音符赋予这样的拍子播放出来，音乐就成了。</p>
<p>这里我们具体以《欢乐颂》为例：</p>
<p><a href="https://images0.cnblogs.com/blog/383503/201309/27231636-6fa10130a1b74fea9fe8017596319ac8.jpg"><img style="display: inline; border: 0px;" title="225316812" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/27231637-d799fe61782542b785f54c182e1be388.jpg" alt="225316812" width="511" height="445" border="0"></a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从简谱看，该音乐是D调的，这里的各音符对应的频率对应的是上表中D调的部分。另外，该音乐为四分之四拍，每个对应为1拍。几个特殊音符说明如下：</p>
<p>第一，普通音符。如第一个音符3，对应频率350，占1拍。</p>
<p>第二，带下划线音符，表示0.5拍。</p>
<p>第三，有的音符后带一个点，表示多加0.5拍，即1+0.5</p>
<p>第四，有的音符后带一个—，表示多加1拍，即1+1</p>
<p>第五，有的两个连续的音符上面带弧线，表示连音，可以稍微改下连音后面那个音的频率，比如减少或增加一些数值（需自己调试），这样表现会更流畅，其实不做处理，影响也不大。</p>
<p>下面，看具体代码：</p>
<div class="cnblogs_code" style="background-color: #f5f5f5; border: #cccccc 1px solid; padding: 5px;"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #0000ff;">#define</span> NTD0 -1
<span style="color: #0000ff;">#define</span> NTD1 294
<span style="color: #0000ff;">#define</span> NTD2 330
<span style="color: #0000ff;">#define</span> NTD3 350
<span style="color: #0000ff;">#define</span> NTD4 393
<span style="color: #0000ff;">#define</span> NTD5 441
<span style="color: #0000ff;">#define</span> NTD6 495
<span style="color: #0000ff;">#define</span> NTD7 556

<span style="color: #0000ff;">#define</span> NTDL1 147
<span style="color: #0000ff;">#define</span> NTDL2 165
<span style="color: #0000ff;">#define</span> NTDL3 175
<span style="color: #0000ff;">#define</span> NTDL4 196
<span style="color: #0000ff;">#define</span> NTDL5 221
<span style="color: #0000ff;">#define</span> NTDL6 248
<span style="color: #0000ff;">#define</span> NTDL7 278

<span style="color: #0000ff;">#define</span> NTDH1 589
<span style="color: #0000ff;">#define</span> NTDH2 661
<span style="color: #0000ff;">#define</span> NTDH3 700
<span style="color: #0000ff;">#define</span> NTDH4 786
<span style="color: #0000ff;">#define</span> NTDH5 882
<span style="color: #0000ff;">#define</span> NTDH6 990
<span style="color: #0000ff;">#define</span> NTDH7 112
<span style="color: #008000;">//列出全部D调的频率</span></pre>
<pre><span style="color: #0000ff;">#define</span> WHOLE 1
<span style="color: #0000ff;">#define</span> HALF 0.5
<span style="color: #0000ff;">#define</span> QUARTER 0.25
<span style="color: #0000ff;">#define</span> EIGHTH 0.25
<span style="color: #0000ff;">#define</span> SIXTEENTH 0.625
//列出所有节拍
<span style="color: #0000ff;">int</span> tune[]=                 //根据简谱列出各频率<span style="color: #000000;">
{
  NTD3,NTD3,NTD4,NTD5,
  NTD5,NTD4,NTD3,NTD2,
  NTD1,NTD1,NTD2,NTD3,
  NTD3,NTD2,NTD2,
  NTD3,NTD3,NTD4,NTD5,
  NTD5,NTD4,NTD3,NTD2,
  NTD1,NTD1,NTD2,NTD3,
  NTD2,NTD1,NTD1,
  NTD2,NTD2,NTD3,NTD1,
  NTD2,NTD3,NTD4,NTD3,NTD1,
  NTD2,NTD3,NTD4,NTD3,NTD2,
  NTD1,NTD2,NTDL5,NTD0,
  NTD3,NTD3,NTD4,NTD5,
  NTD5,NTD4,NTD3,NTD4,NTD2,
  NTD1,NTD1,NTD2,NTD3,
  NTD2,NTD1,NTD1
};
</span><span style="color: #0000ff;">float</span> durt[]=                   //根据简谱列出各节拍<span style="color: #000000;">
{
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>+<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>+<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>+<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>+<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>+<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>+<span style="color: #800080;">1</span><span style="color: #000000;">,
};
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> length;
</span><span style="color: #0000ff;">int</span> tonepin=<span style="color: #800080;">6</span><span style="color: #000000;">;   //得用6号接口
</span><span style="color: #0000ff;">void</span><span style="color: #000000;"> setup()
{
  pinMode(tonepin,OUTPUT);
  length</span>=<span style="color: #0000ff;">sizeof</span>(tune)/<span style="color: #0000ff;">sizeof</span>(tune[<span style="color: #800080;">0</span><span style="color: #000000;">]);   //计算长度
}
</span><span style="color: #0000ff;">void</span><span style="color: #000000;"> loop()
{
  </span><span style="color: #0000ff;">for</span>(<span style="color: #0000ff;">int</span> x=<span style="color: #800080;">0</span>;x&lt;length;x++<span style="color: #000000;">)
  {
    tone(tonepin,tune[x]);
    delay(</span><span style="color: #800080;">500</span>*<span style="color: #000000;">durt[x]);   //这里用来根据节拍调节延时，500这个指数可以自己调整，在该音乐中，我发现用500比较合适。
    noTone(tonepin);
  }
  delay(</span><span style="color: #800080;">2000</span><span style="color: #000000;">);
}</span></pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>实验视频如下：</p>
<p>&nbsp;<object width="320" height="240" data="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/v.swf(1).下载" type="application/x-shockwave-flash"><param name="src" value="http://player.youku.com/player.php/sid/XNjE0NDgyNDUy/v.swf"></object></p>
<h2>四、LED灯伴随音乐闪烁</h2>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 结何入门笔记（3）（<a title="http://wikicode.net/?p=163" href="http://wikicode.net/?p=163">http://wikicode.net/?p=163</a>或者<a title="http://www.cnblogs.com/xiaowuyi/p/3337739.html" href="http://www.cnblogs.com/xiaowuyi/p/3337739.html">http://www.cnblogs.com/xiaowuyi/p/3337739.html</a>），做一个LED灯伴随音乐进行闪烁。实验布线图和原理图如下：</p>
<p><a href="https://images0.cnblogs.com/blog/383503/201309/27231637-5e6570be62b44bbab47f6c104ee1bd78.jpg"><img style="display: inline; border: 0px;" title="buxian2" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/27231638-e4bbdaecff6c44c3b0f209117cc8e9de.jpg" alt="buxian2" width="331" height="383" border="0"></a> <a href="https://images0.cnblogs.com/blog/383503/201309/27231639-4189ce5d8606419b85a87a3155c5c2ce.jpg"><img style="display: inline; border: 0px;" title="yuanli2" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/27231639-63de51ed7d5448179bfd7000a095c565.jpg" alt="yuanli2" width="318" height="380" border="0"></a></p>
<p>&nbsp;</p>
<p>实验代码为：</p>
<div class="cnblogs_code" style="background-color: #f5f5f5; border: #cccccc 1px solid; padding: 5px;"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #0000ff;">#define</span> NTD0 -1
<span style="color: #0000ff;">#define</span> NTD1 294
<span style="color: #0000ff;">#define</span> NTD2 330
<span style="color: #0000ff;">#define</span> NTD3 350
<span style="color: #0000ff;">#define</span> NTD4 393
<span style="color: #0000ff;">#define</span> NTD5 441
<span style="color: #0000ff;">#define</span> NTD6 495
<span style="color: #0000ff;">#define</span> NTD7 556

<span style="color: #0000ff;">#define</span> NTDL1 147
<span style="color: #0000ff;">#define</span> NTDL2 165
<span style="color: #0000ff;">#define</span> NTDL3 175
<span style="color: #0000ff;">#define</span> NTDL4 196
<span style="color: #0000ff;">#define</span> NTDL5 221
<span style="color: #0000ff;">#define</span> NTDL6 248
<span style="color: #0000ff;">#define</span> NTDL7 278

<span style="color: #0000ff;">#define</span> NTDH1 589
<span style="color: #0000ff;">#define</span> NTDH2 661
<span style="color: #0000ff;">#define</span> NTDH3 700
<span style="color: #0000ff;">#define</span> NTDH4 786
<span style="color: #0000ff;">#define</span> NTDH5 882
<span style="color: #0000ff;">#define</span> NTDH6 990
<span style="color: #0000ff;">#define</span> NTDH7 112
<span style="color: #008000;">//</span><span style="color: #008000;">c pinlv</span>
<span style="color: #0000ff;">#define</span> WHOLE 1
<span style="color: #0000ff;">#define</span> HALF 0.5
<span style="color: #0000ff;">#define</span> QUARTER 0.25
<span style="color: #0000ff;">#define</span> EIGHTH 0.25
<span style="color: #0000ff;">#define</span> SIXTEENTH 0.625

<span style="color: #0000ff;">int</span> tune[]=<span style="color: #000000;">
{
  NTD3,NTD3,NTD4,NTD5,
  NTD5,NTD4,NTD3,NTD2,
  NTD1,NTD1,NTD2,NTD3,
  NTD3,NTD2,NTD2,
  NTD3,NTD3,NTD4,NTD5,
  NTD5,NTD4,NTD3,NTD2,
  NTD1,NTD1,NTD2,NTD3,
  NTD2,NTD1,NTD1,
  NTD2,NTD2,NTD3,NTD1,
  NTD2,NTD3,NTD4,NTD3,NTD1,
  NTD2,NTD3,NTD4,NTD3,NTD2,
  NTD1,NTD2,NTDL5,NTD0,
  NTD3,NTD3,NTD4,NTD5,
  NTD5,NTD4,NTD3,NTD4,NTD2,
  NTD1,NTD1,NTD2,NTD3,
  NTD2,NTD1,NTD1
};
</span><span style="color: #0000ff;">float</span> durt[]=<span style="color: #000000;">
{
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>+<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>+<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>+<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>+<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span>,<span style="color: #800080;">1</span><span style="color: #000000;">,
  </span><span style="color: #800080;">1</span>+<span style="color: #800080;">0.5</span>,<span style="color: #800080;">0.5</span>,<span style="color: #800080;">1</span>+<span style="color: #800080;">1</span><span style="color: #000000;">,
};
</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> length;
</span><span style="color: #0000ff;">int</span> tonepin=<span style="color: #800080;">6</span><span style="color: #000000;">;
</span><span style="color: #0000ff;">int</span> ledp=<span style="color: #800080;">1</span><span style="color: #000000;">;
</span><span style="color: #0000ff;">void</span><span style="color: #000000;"> setup()
{
  pinMode(tonepin,OUTPUT);
  pinMode(ledp,OUTPUT);
  length</span>=<span style="color: #0000ff;">sizeof</span>(tune)/<span style="color: #0000ff;">sizeof</span>(tune[<span style="color: #800080;">0</span><span style="color: #000000;">]);
}
</span><span style="color: #0000ff;">void</span><span style="color: #000000;"> loop()
{
  </span><span style="color: #0000ff;">for</span>(<span style="color: #0000ff;">int</span> x=<span style="color: #800080;">0</span>;x&lt;length;x++<span style="color: #000000;">)
  {
    tone(tonepin,tune[x]);
    digitalWrite(ledp, HIGH); 
    delay(</span><span style="color: #800080;">400</span>*durt[x]);<span style="color: #008000;">//</span><span style="color: #008000;">与前一代码不同之处，这里将原来的500分为了400和100，分别控制led的开与关，对于蜂鸣器来说依然是500.</span>
<span style="color: #000000;">    digitalWrite(ledp, LOW);
    delay(</span><span style="color: #800080;">100</span>*<span style="color: #000000;">durt[x]);
    noTone(tonepin);
    
  }
  delay(</span><span style="color: #800080;">2000</span><span style="color: #000000;">);
}</span></pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>实验视频为：</p>
<p><object width="320" height="240" data="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/v.swf(2).下载" type="application/x-shockwave-flash"><param name="src" value="http://player.youku.com/player.php/sid/XNjE0NDg1MTg0/v.swf"></object></p>
<p>从视频来看，LED的闪烁还有点不合节奏，可以调整下程序中400和100的分配，使其看上去更合拍。</p>
</div>
<div id="MySignature"></div>
<div class="clear"></div>
<div id="blog_post_info_block"><div id="BlogPostCategory">
    分类: 
            <a href="https://www.cnblogs.com/xiaowuyi/category/497388.html" target="_blank">Arduino</a></div>
<div id="EntryTag">
    标签: 
            <a href="https://www.cnblogs.com/xiaowuyi/tag/arduino/">arduino</a>,             <a href="https://www.cnblogs.com/xiaowuyi/tag/%E5%BC%80%E6%BA%90%E7%A1%AC%E4%BB%B6/">开源硬件</a>,             <a href="https://www.cnblogs.com/xiaowuyi/tag/%E8%9C%82%E9%B8%A3%E5%99%A8/">蜂鸣器</a>,             <a href="https://www.cnblogs.com/xiaowuyi/tag/LED/">LED</a></div>

    <div id="blog_post_info">
<div id="green_channel">
        <a href="javascript:void(0);" id="green_channel_digg" onclick="DiggIt(3343757,cb_blogId,1);green_channel_success(this,&#39;谢谢推荐！&#39;);">好文要顶</a>
        <a id="green_channel_follow" onclick="follow(&#39;b609db10-0f69-e111-aa3f-842b2b196315&#39;);" href="javascript:void(0);">关注我</a>
    <a id="green_channel_favorite" onclick="AddToWz(cb_entryId);return false;" href="javascript:void(0);">收藏该文</a>
    <a id="green_channel_weibo" href="javascript:void(0);" title="分享至新浪微博" onclick="ShareToTsina()"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/icon_weibo_24.png" alt=""></a>
    <a id="green_channel_wechat" href="javascript:void(0);" title="分享至微信" onclick="shareOnWechat()"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/wechat.png" alt=""></a>
</div>
<div id="author_profile">
    <div id="author_profile_info" class="author_profile_info">
            <a href="https://home.cnblogs.com/u/xiaowuyi/" target="_blank"><img src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/u383503.jpg" class="author_avatar" alt=""></a>
        <div id="author_profile_detail" class="author_profile_info">
            <a href="https://home.cnblogs.com/u/xiaowuyi/">小五义</a><br>
            <a href="https://home.cnblogs.com/u/xiaowuyi/followees/">关注 - 9</a><br>
            <a href="https://home.cnblogs.com/u/xiaowuyi/followers/">粉丝 - 485</a>
        </div>
    </div>
    <div class="clear"></div>
    <div id="author_profile_honor"></div>
    <div id="author_profile_follow">
                <a href="javascript:void(0);" onclick="follow(&#39;b609db10-0f69-e111-aa3f-842b2b196315&#39;);return false;">+加关注</a>
    </div>
</div>
<div id="div_digg">
    <div class="diggit" onclick="votePost(3343757,&#39;Digg&#39;)">
        <span class="diggnum" id="digg_count">6</span>
    </div>
    <div class="buryit" onclick="votePost(3343757,&#39;Bury&#39;)">
        <span class="burynum" id="bury_count">0</span>
    </div>
    <div class="clear"></div>
    <div class="diggword" id="digg_tips">
    </div>
</div>

<script type="text/javascript">
    currentDiggType = 0;
</script></div>
    <div class="clear"></div>
    <div id="post_next_prev">

    <a href="https://www.cnblogs.com/xiaowuyi/p/3342460.html" class="p_n_p_prefix">« </a> 上一篇：    <a href="https://www.cnblogs.com/xiaowuyi/p/3342460.html" title="发布于 2013-09-27 11:43">scapy学习笔记（4）简单的sniffing 嗅探</a>
    <br>
    <a href="https://www.cnblogs.com/xiaowuyi/p/3345561.html" class="p_n_p_prefix">» </a> 下一篇：    <a href="https://www.cnblogs.com/xiaowuyi/p/3345561.html" title="发布于 2013-09-29 13:23">scapy学习笔记（5）</a>

</div>
</div>
            </div>
            <div class="postDesc">posted @ 
<span id="post-date">2013-09-28 00:00</span>&nbsp;
<a href="https://www.cnblogs.com/xiaowuyi/">小五义</a>&nbsp;
阅读(<span id="post_view_count">62202</span>)&nbsp;
评论(<span id="post_comment_count">0</span>)&nbsp;
<a href="https://i.cnblogs.com/EditPosts.aspx?postid=3343757" rel="nofollow">
    编辑
</a>
<a href="javascript:void(0)" onclick="AddToWz(3343757);return false;">收藏</a></div>
        </div>
<script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/highlight.min.js.下载"></script>
<script>markdown_highlight();</script>
<script>
    var allowComments = true, cb_blogId = 111015, cb_blogApp = 'xiaowuyi', cb_blogUserGuid = 'b609db10-0f69-e111-aa3f-842b2b196315';
    var cb_entryId = 3343757, cb_entryCreatedDate = '2013-09-28 00:00', cb_postType = 1; 
    loadViewCount(cb_entryId);
</script><a name="!comments"></a>
<div id="blog-comments-placeholder"></div>
<script>
    var commentManager = new blogCommentManager();
    commentManager.renderComments(0);
</script>

<div id="comment_form" class="commentform">
    <a name="commentform"></a>
    <div id="divCommentShow"></div>
    <div id="comment_nav"><span id="span_refresh_tips"></span><a href="javascript:void(0);" onclick="return RefreshCommentList();" id="lnk_RefreshComments" runat="server" clientidmode="Static">刷新评论</a><a href="https://www.cnblogs.com/xiaowuyi/p/3343757.html#" onclick="return RefreshPage();">刷新页面</a><a href="https://www.cnblogs.com/xiaowuyi/p/3343757.html#top">返回顶部</a></div>
    <div id="comment_form_container"><div class="login_tips">
    注册用户登录后才能发表评论，请 
    <a rel="nofollow" href="javascript:void(0);" class="underline" onclick="return login(&#39;commentform&#39;);">登录</a>
     或 
    <a rel="nofollow" href="javascript:void(0);" class="underline" onclick="return register();">注册</a>，
    <a href="https://www.cnblogs.com/">访问</a> 网站首页。
</div></div>
    <div class="ad_text_commentbox" id="ad_text_under_commentbox"></div>
    <div id="ad_t2"><a href="http://www.ucancode.com/index.htm" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-工控&#39;)">【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库</a><br><a href="https://cloud.tencent.com/act/seckill?fromSource=gwzcw.3168381.3168381.3168381&amp;utm_medium=cpc&amp;utm_id=gwzcw.3168381.3168381.3168381" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-腾讯云&#39;)">【推荐】腾讯云热门云产品限时秒杀，爆款1核2G云服务器99元/年！</a><br><a href="http://click.aliyun.com/m/1000081987/" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-阿里云&#39;)">【推荐】阿里云双11返场来袭，热门产品低至一折等你来抢！</a><br><a href="https://www.dingxiang-inc.com/business/console?from=cnblogs" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-顶象&#39;)">【推荐】顶象AI风控引擎，精准过滤风险请求，立即免费体验！</a><br><a href="https://www.ctyun.cn/activity/20191111?hmsr=%E7%9C%8B%E7%9C%8B-%E5%8D%9A%E5%AE%A2%E5%9B%AD-%E5%8F%8C11-1106&amp;hmpl=&amp;hmcu=&amp;hmkw=&amp;hmci=" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-天翼云&#39;)">【推荐】天翼云双十一翼降到底，云主机11.11元起，抽奖送大礼</a><br><a href="https://www.jdcloud.com/cn/activity/year-end?utm_source=DMT_cnblogs&amp;utm_medium=CH&amp;utm_campaign=q4vm&amp;utm_term=Virtual-Machines" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-京东云&#39;)">【活动】京东云服务器_云主机低于1折，低价高性能产品备战双11</a><br><a href="https://www.qiniu.com/events/20191111?utm_campaign=2019_1111&amp;utm_content=cnblogs_1111&amp;utm_medium=banner&amp;utm_source=cnblogs&amp;utm_term=cnblogs_1111" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T2-七牛云&#39;)">【优惠】七牛云采购嘉年华，云存储、CDN等云产品低至1折</a><br></div>
    <div id="opt_under_post"></div>
    <script async="async" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/gpt.js.下载"></script>
    <script>
        var googletag = googletag || {};
        googletag.cmd = googletag.cmd || [];
    </script>
    <script>
        googletag.cmd.push(function () {
            googletag.defineSlot("/1090369/C1", [300, 250], "div-gpt-ad-1546353474406-0").addService(googletag.pubads());
            googletag.defineSlot("/1090369/C2", [468, 60], "div-gpt-ad-1539008685004-0").addService(googletag.pubads());
            googletag.pubads().enableSingleRequest();
            googletag.enableServices();
        });
    </script>
    <div id="cnblogs_c1" class="c_ad_block">
        <div id="div-gpt-ad-1546353474406-0" style="height:250px; width:300px;" data-google-query-id="CM-e-OP4p-YCFQt1vQodOd8HUA"><div id="google_ads_iframe_/1090369/C1_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/1090369/C1_0" title="3rd party ad content" name="google_ads_iframe_/1090369/C1_0" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border: 0px; vertical-align: bottom;" data-google-container-id="1" data-load-complete="true" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/saved_resource.html"></iframe></div></div>
    </div>
    <div id="under_post_news"><div class="recomm-block"><b>相关博文：</b><br>·  <a title="STM32使用无源蜂鸣器演奏歌曲" href="https://www.cnblogs.com/wzben/p/5079303.html" target="_blank" onclick="clickRecomItmem(5079303)">STM32使用无源蜂鸣器演奏歌曲</a><br>·  <a title="[51单片机学习笔记TWO]----蜂鸣器" href="https://www.cnblogs.com/one-meter/p/4138956.html" target="_blank" onclick="clickRecomItmem(4138956)">[51单片机学习笔记TWO]----蜂鸣器</a><br>·  <a title="Arduino入门笔记（3）：单LED闪烁" href="https://www.cnblogs.com/xiaowuyi/p/3337739.html" target="_blank" onclick="clickRecomItmem(3337739)">Arduino入门笔记（3）：单LED闪烁</a><br>·  <a title="Arduino入门笔记（6）:温度传感器及感温杯实验" href="https://www.cnblogs.com/xiaowuyi/p/3395326.html" target="_blank" onclick="clickRecomItmem(3395326)">Arduino入门笔记（6）:温度传感器及感温杯实验</a><br>·  <a title="新手读懂五线谱" href="https://www.cnblogs.com/fanzhidongyzby/archive/2013/03/18/2965859.html" target="_blank" onclick="clickRecomItmem(2965859)">新手读懂五线谱</a><br>»  <a target="_blank" href="https://recomm.cnblogs.com/blogpost/3343757">更多推荐...</a><div id="cnblogs_t5"><a href="https://developer.aliyun.com/article/718700?utm_content=g_1000088931" target="_blank" onclick="ga(&#39;send&#39;, &#39;event&#39;, &#39;Link&#39;, &#39;click&#39;, &#39;T5-阿里云开发者社区&#39;)">免费下载《阿里工程师的自我修养》</a></div></div></div>
    <div id="cnblogs_c2" class="c_ad_block">
        <div id="div-gpt-ad-1539008685004-0" style="height:60px; width:468px;" data-google-query-id="CNCe-OP4p-YCFQt1vQodOd8HUA">
            
        <div id="google_ads_iframe_/1090369/C2_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/1090369/C2_0" title="3rd party ad content" name="google_ads_iframe_/1090369/C2_0" width="468" height="60" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border: 0px; vertical-align: bottom;" data-google-container-id="2" data-load-complete="true" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/saved_resource(1).html"></iframe></div></div>
    </div>
    <div id="under_post_kb">
<div class="itnews c_ad_block">
    <b>最新 IT 新闻</b>:
    <br>
 ·              <a href="https://news.cnblogs.com/n/651643/" target="_blank">中科院世界首例“猪猴同体”混合生物，出生一周内死亡</a>
            <br>
 ·              <a href="https://news.cnblogs.com/n/651642/" target="_blank">AMD Zen 4架构CPU 2021年发布，采用台积电5nm工艺</a>
            <br>
 ·              <a href="https://news.cnblogs.com/n/651641/" target="_blank">探索自动驾驶技术落地，腾讯技术开放日在北京举办</a>
            <br>
 ·              <a href="https://news.cnblogs.com/n/651640/" target="_blank">猪瘟推高世界食品价格</a>
            <br>
 ·              <a href="https://news.cnblogs.com/n/651639/" target="_blank">国产电动一哥又发力：拿下荷兰巨额订单 成欧洲电动大巴第一！</a>
            <br>
    » <a href="https://news.cnblogs.com/" title="IT 新闻" target="_blank">更多新闻...</a>
</div></div>
    <div id="HistoryToday" class="c_ad_block"></div>
    <script type="text/javascript">
        fixPostBody();
        setTimeout(function () { incrementViewCount(cb_entryId); }, 50);
        deliverAdT2();
        deliverAdC1();
        deliverAdC2();
        loadNewsAndKb();
        loadBlogSignature();
LoadPostCategoriesTags(cb_blogId, cb_entryId);        LoadPostInfoBlock(cb_blogId, cb_entryId, cb_blogApp, cb_blogUserGuid);
        GetPrevNextPost(cb_entryId, cb_blogId, cb_entryCreatedDate, cb_postType);
        loadOptUnderPost();
        GetHistoryToday(cb_blogId, cb_blogApp, cb_entryCreatedDate);
    </script>
</div>    </div>
</div>
            </div>
        </div>

        <div id="sideBar">
            <div id="sideBarMain">
                
<div id="sidebar_news" class="newsItem">
<h3 class="catListTitle">公告</h3>

<div id="blog-news">
    <p>引用本博客内容，请注明出处，谢谢!
@小五义 http://www.cnblogs.com/xiaowuyi</p>
<p>
</p><div>
欢迎加入QQ群：157816561  
<div></div>
</div>
<p></p>
    <div id="profile_block">
        昵称：
        <a href="https://home.cnblogs.com/u/xiaowuyi/">
            小五义
        </a>
        <br>
        园龄：
        <a href="https://home.cnblogs.com/u/xiaowuyi/" title="入园时间：2012-03-08">
            7年9个月
        </a>
        <br>
        粉丝：
        <a href="https://home.cnblogs.com/u/xiaowuyi/followers/">
            485
        </a>
        <br>
        关注：
        <a href="https://home.cnblogs.com/u/xiaowuyi/followees/">
            9
        </a>
        <div id="p_b_follow">
<a href="javascript:void(0)" onclick="follow(&#39;b609db10-0f69-e111-aa3f-842b2b196315&#39;)">+加关注</a></div>
        <script>getFollowStatus('b609db10-0f69-e111-aa3f-842b2b196315');</script>
    </div>
</div></div>

                <div id="calendar"><div id="blog-calendar" style="">

<table id="blogCalendar" class="Cal" cellspacing="0" cellpadding="0" title="Calendar" border="0">
    <tbody>
        <tr>
            <td colspan="7">
                <table class="CalTitle" cellspacing="0" border="0">
                    <tbody>
                        <tr>
                            <td class="CalNextPrev">
                                <a href="javascript:void(0);" onclick="loadBlogCalendar(&#39;2019/11/09&#39;); return false;">&lt;</a>
                            </td>
                            <td align="center">2019年12月</td>
                            <td align="right" class="CalNextPrev">
                                <a href="javascript:void(0);" onclick="loadBlogCalendar(&#39;2020/01/09&#39;); return false;">&gt;</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
                    <th class="CalDayHeader" align="center" abbr="日" scope="col">日</th>
                    <th class="CalDayHeader" align="center" abbr="一" scope="col">一</th>
                    <th class="CalDayHeader" align="center" abbr="二" scope="col">二</th>
                    <th class="CalDayHeader" align="center" abbr="三" scope="col">三</th>
                    <th class="CalDayHeader" align="center" abbr="四" scope="col">四</th>
                    <th class="CalDayHeader" align="center" abbr="五" scope="col">五</th>
                    <th class="CalDayHeader" align="center" abbr="六" scope="col">六</th>
        </tr>
            <tr>
                        <td class="CalWeekendDay" align="center">
                            1
                        </td>
                        <td class="" align="center">
                            2
                        </td>
                        <td class="" align="center">
                            3
                        </td>
                        <td class="" align="center">
                            4
                        </td>
                        <td class="" align="center">
                            5
                        </td>
                        <td class="" align="center">
                            6
                        </td>
                    <td class="CalWeekendDay" align="center">
                        7
                    </td>
            </tr>
                <tr>
                        <td class="CalWeekendDay" align="center">
                            8
                        </td>
                            <td class="CalTodayDay" align="center">
                                9
                            </td>
                            <td class="" align="center">
                                10
                            </td>
                            <td class="" align="center">
                                11
                            </td>
                            <td class="" align="center">
                                12
                            </td>
                            <td class="" align="center">
                                13
                            </td>
                        <td class="CalWeekendDay" align="center">
                            14
                        </td>
                </tr>
                <tr>
                        <td class="CalWeekendDay" align="center">
                            15
                        </td>
                            <td class="" align="center">
                                16
                            </td>
                            <td class="" align="center">
                                17
                            </td>
                            <td class="" align="center">
                                18
                            </td>
                            <td class="" align="center">
                                19
                            </td>
                            <td class="" align="center">
                                20
                            </td>
                        <td class="CalWeekendDay" align="center">
                            21
                        </td>
                </tr>
                <tr>
                        <td class="CalWeekendDay" align="center">
                            22
                        </td>
                            <td class="" align="center">
                                23
                            </td>
                            <td class="" align="center">
                                24
                            </td>
                            <td class="" align="center">
                                25
                            </td>
                            <td class="" align="center">
                                26
                            </td>
                            <td class="" align="center">
                                27
                            </td>
                        <td class="CalWeekendDay" align="center">
                            28
                        </td>
                </tr>
                <tr>
                        <td class="CalWeekendDay" align="center">
                            29
                        </td>
                            <td class="" align="center">
                                30
                            </td>
                            <td class="" align="center">
                                31
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                1
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                2
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                3
                            </td>
                        <td class="CalOtherMonthDay" align="center">
                            4
                        </td>
                </tr>
                <tr>
                        <td class="CalOtherMonthDay" align="center">
                            5
                        </td>
                            <td class="CalOtherMonthDay" align="center">
                                6
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                7
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                8
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                9
                            </td>
                            <td class="CalOtherMonthDay" align="center">
                                10
                            </td>
                        <td class="CalOtherMonthDay" align="center">
                            11
                        </td>
                </tr>
    </tbody>
</table></div></div>                
                <script>loadBlogDefaultCalendar();</script>
                <div id="leftcontentcontainer">
                    <!-- begin:SingleColumn -->
                    <div id="blog-sidecolumn">
<!-- 搜索 -->
<div id="sidebar_search" class="sidebar-block">
    <div id="sidebar_search" class="mySearch">
        <h3 class="catListTitle">搜索</h3>
        <div id="sidebar_search_box">
            <div id="widget_my_zzk" class="div_my_zzk">
                <input type="text" id="q" onkeydown="return zzk_go_enter(event);" class="input_my_zzk">&nbsp;<input onclick="zzk_go()" type="button" value="找找看" id="btnZzk" class="btn_my_zzk">
            </div>
            <div id="widget_my_google" class="div_my_zzk">
                <input type="text" name="google_q" id="google_q" onkeydown="return google_go_enter(event);" class="input_my_zzk">&nbsp;<input onclick="google_go()" type="button" value="谷歌搜索" class="btn_my_zzk">
            </div>
        </div>
    </div>
</div>

<!-- 常用链接 -->
<div id="sidebar_shortcut" class="sidebar-block">
    
<h3 class="catListTitle">
常用链接
</h3>
<ul>
        <li>

<a href="https://www.cnblogs.com/xiaowuyi/p/" title="我的博客的随笔列表">我的随笔</a>
</li>
        <li>

<a href="https://www.cnblogs.com/xiaowuyi/MyComments.html" title="我的发表过的评论列表">我的评论</a>
</li>
        <li>

<a href="https://www.cnblogs.com/xiaowuyi/OtherPosts.html" title="我评论过的随笔列表">我的参与</a>
</li>
        <li>

<a href="https://www.cnblogs.com/xiaowuyi/RecentComments.html" title="我的博客的评论列表">最新评论</a>
</li>
        <li>

<a href="https://www.cnblogs.com/xiaowuyi/tag/" title="我的博客的标签列表">我的标签</a>
</li>
</ul>

<!-- TODO: 检查是否有使用这一部分的控件，如果没有则应该删除。 -->
<div id="itemListLin_con" style="display:none">
    <ul>

    </ul>
</div>

</div>

<!-- 最新随笔 -->
<div id="sidebar_recentposts" class="sidebar-block">
    
<div class="catListEssay">
    <h3 class="catListTitle">最新随笔</h3>
    <ul>
                <li>
                    

<a href="https://www.cnblogs.com/xiaowuyi/p/11491656.html">1.MicroPython TPYBoard v102 无线红外遥控舵机(基于红外解/编码模块)</a>

                </li>
                <li>
                    

<a href="https://www.cnblogs.com/xiaowuyi/p/11307132.html">2.Micropython TPYBoard v102 温湿度短信通知器（基于SIM900A模块）</a>

                </li>
                <li>
                    

<a href="https://www.cnblogs.com/xiaowuyi/p/11264445.html">3.MicroPython TPYBoard v201 简易家庭气象站的实现过程</a>

                </li>
                <li>
                    

<a href="https://www.cnblogs.com/xiaowuyi/p/11224188.html">4.micropython TPYBoard v201 简易的web服务器的实现过程</a>

                </li>
                <li>
                    

<a href="https://www.cnblogs.com/xiaowuyi/p/11118547.html">5.使用Visual Studio Code进行MicroPython编程</a>

                </li>
    </ul>
</div>

</div>


<!-- 我的标签 -->


<!-- 积分与排名 -->
<div id="sidebar_scorerank" class="sidebar-block">
    
<div class="catListBlogRank">
    <h3 class="catListTitle">积分与排名</h3>
    <ul>
        <li class="liScore">
            积分 - 
327186
        </li>
        <li class="liRank">
            排名 - 
965
        </li>
    </ul>
</div>
</div>

<!-- 随笔分类、随笔档案、文章分类、新闻分类、相册、链接 -->
<div id="sidebar_categories">
    
        <div class="catListPostCategory">
            <h3 class="catListTitle">
                

随笔分类



            </h3>
            <ul>
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/361866.html" rel="" target="">
    .NET 学习笔记(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/454479.html" rel="" target="">
    android(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/497388.html" rel="" target="">
    Arduino(18)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/648489.html" rel="" target="">
    opencv-python(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/426566.html" rel="" target="">
    pygame学习笔记(6)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/401225.html" rel="" target="">
    python趣味编程(8)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/426565.html" rel="" target="">
    python网络编程(16)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/361149.html" rel="" target="">
    python学习笔记(48)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/854039.html" rel="" target="">
    TPYBoard-micropython(28)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/499067.html" rel="" target="">
    ubuntu(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/786103.html" rel="" target="">
    单片机(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/611904.html" rel="" target="">
    树莓派(9)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/544309.html" rel="" target="">
    网络安全(5)
</a>

                            

                        </li>
                        
            </ul>
        </div>
        <div class="catListPostArchive">
            <h3 class="catListTitle">
                

随笔档案



            </h3>
            <ul>
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/09.html" rel="" target="">
    2019年9月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/08.html" rel="" target="">
    2019年8月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/07.html" rel="" target="">
    2019年7月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/06.html" rel="" target="">
    2019年6月(4)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/04.html" rel="" target="">
    2019年4月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/03.html" rel="" target="">
    2019年3月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2019/02.html" rel="" target="">
    2019年2月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2018/09.html" rel="" target="">
    2018年9月(5)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2018/08.html" rel="" target="">
    2018年8月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2018/07.html" rel="" target="">
    2018年7月(7)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2018/06.html" rel="" target="">
    2018年6月(6)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2018/05.html" rel="" target="">
    2018年5月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/10.html" rel="" target="">
    2017年10月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/09.html" rel="" target="">
    2017年9月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/08.html" rel="" target="">
    2017年8月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/07.html" rel="" target="">
    2017年7月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/06.html" rel="" target="">
    2017年6月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/03.html" rel="" target="">
    2017年3月(4)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/02.html" rel="" target="">
    2017年2月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2017/01.html" rel="" target="">
    2017年1月(4)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2016/07.html" rel="" target="">
    2016年7月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2016/02.html" rel="" target="">
    2016年2月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2016/01.html" rel="" target="">
    2016年1月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2015/11.html" rel="" target="">
    2015年11月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2015/09.html" rel="" target="">
    2015年9月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2015/03.html" rel="" target="">
    2015年3月(5)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2015/01.html" rel="" target="">
    2015年1月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/12.html" rel="" target="">
    2014年12月(5)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/11.html" rel="" target="">
    2014年11月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/10.html" rel="" target="">
    2014年10月(5)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/09.html" rel="" target="">
    2014年9月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/08.html" rel="" target="">
    2014年8月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/03.html" rel="" target="">
    2014年3月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2014/02.html" rel="" target="">
    2014年2月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/12.html" rel="" target="">
    2013年12月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/11.html" rel="" target="">
    2013年11月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/10.html" rel="" target="">
    2013年10月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/09.html" rel="" target="">
    2013年9月(7)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/08.html" rel="" target="">
    2013年8月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/07.html" rel="" target="">
    2013年7月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2013/02.html" rel="" target="">
    2013年2月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/11.html" rel="" target="">
    2012年11月(3)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/10.html" rel="" target="">
    2012年10月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/09.html" rel="" target="">
    2012年9月(4)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/08.html" rel="" target="">
    2012年8月(6)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/07.html" rel="" target="">
    2012年7月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/06.html" rel="" target="">
    2012年6月(6)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/05.html" rel="" target="">
    2012年5月(5)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/04.html" rel="" target="">
    2012年4月(2)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archive/2012/03.html" rel="" target="">
    2012年3月(14)
</a>

                            

                        </li>
                        
            </ul>
        </div>
        <div class="catListArticleCategory">
            <h3 class="catListTitle">
                

文章分类



            </h3>
            <ul>
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/361421.html" rel="" target="">
    python精彩文章收集(12)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/category/651296.html" rel="" target="">
    树莓派精彩文章收集(1)
</a>

                            

                        </li>
                        
            </ul>
        </div>
        <div class="catListArticleArchive">
            <h3 class="catListTitle">
                

文章档案



            </h3>
            <ul>
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2015/02.html" rel="nofollow noopener noreferrer" target="">
    2015年2月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2015/01.html" rel="nofollow noopener noreferrer" target="">
    2015年1月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2012/08.html" rel="nofollow noopener noreferrer" target="">
    2012年8月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2012/06.html" rel="nofollow noopener noreferrer" target="">
    2012年6月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2012/05.html" rel="nofollow noopener noreferrer" target="">
    2012年5月(4)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2012/04.html" rel="nofollow noopener noreferrer" target="">
    2012年4月(1)
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="https://www.cnblogs.com/xiaowuyi/archives/2012/03.html" rel="nofollow noopener noreferrer" target="">
    2012年3月(4)
</a>

                            

                        </li>
                        
            </ul>
        </div>
        <div class="catList">
            <h3 class="catListTitle">
                

python相关网址



            </h3>
            <ul>
                        <li>
                            
<a href="http://www.itlong.com/forum.php" rel="nofollow noopener noreferrer" target="_blank">
    python
</a>

                            

                        </li>
                        <li class="c_b_p_link_desc">python论坛</li>
                        <li>
                            
<a href="http://sourceforge.net/projects/pyhook" rel="nofollow noopener noreferrer" target="_blank">
    pyhook下载
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="http://eyehere.net/2011/python-pygame-novice-professional-index/" rel="nofollow noopener noreferrer" target="">
    eyehere
</a>

                            

                        </li>
                        <li class="c_b_p_link_desc">pygame学习</li>
                        <li>
                            
<a href="http://www.erlang.org/doc/man/wxDatePickerCtrl.html#setValue-2" rel="nofollow noopener noreferrer" target="">
    wxpython文档
</a>

                            

                        </li>
                        
                        <li>
                            
<a href="http://www.cnblogs.com/k1two2/" rel="nofollow noopener noreferrer" target="">
    k1two2
</a>

                            

                        </li>
                        <li class="c_b_p_link_desc">http://www.cnblogs.com/k1two2/</li>
            </ul>
        </div>

</div>

<!-- 最新评论 -->
<div id="sidebar_recentcomments" class="sidebar-block">
    <div id="recent_comments_wrap" class="RecentComment">
    <h3 class="catListTitle">最新评论</h3>
    <div class="RecentCommentBlock">
        <ul>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/xiaowuyi/p/10718364.html#4443805">1. Re:毕业设计5：基于MicroPython的智能火灾报警器系统的设计与实现</a></li>
                    <li class="recent_comment_body">大佬  有代码吗</li>
                    <li class="recent_comment_author">--s_sy</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/xiaowuyi/p/9608606.html#4403438">2. Re:wps for linux显示系统缺失字体解决办法</a></li>
                    <li class="recent_comment_body">能够使用，谢谢博主。</li>
                    <li class="recent_comment_author">--小白的学习日记</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/xiaowuyi/p/11307132.html#4366267">3. Re:Micropython TPYBoard v102 温湿度短信通知器（基于SIM900A模块）</a></li>
                    <li class="recent_comment_body">我自己做的时候SIM900A模块识别不了4G移动手机卡是怎么一回事呢，望指导</li>
                    <li class="recent_comment_author">--patrick1999</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/xiaowuyi/p/11491656.html#4355372">4. Re:MicroPython TPYBoard v102 无线红外遥控舵机(基于红外解/编码模块)</a></li>
                    <li class="recent_comment_body">五义兄有木有做过自动跟踪猫的diy设备，可以装在家里，自动跟踪家里的猫并实时拍摄视频的哈哈</li>
                    <li class="recent_comment_author">--郑瀚Andrew.Hann</li>
                    <li class="recent_comment_title"><a href="https://www.cnblogs.com/xiaowuyi/p/11264445.html#4311679">5. Re:MicroPython TPYBoard v201 简易家庭气象站的实现过程</a></li>
                    <li class="recent_comment_body">实用，顶</li>
                    <li class="recent_comment_author">--郑瀚Andrew.Hann</li>
        </ul>
    </div>
</div>
</div>



<!-- 阅读排行榜 -->
<div id="sidebar_topviewedposts" class="sidebar-block">
    
<div id="topview_posts_wrap">
    <h3 class="catListTitle">阅读排行榜</h3>
    <div id="TopViewPostsBlock">
        <ul style="word-break:break-all">
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/p/4051238.html">
                            1. 树莓派学习笔记（5）：成功实现NAS家庭服务器（流媒体播放、文件共享及下载机）(145042)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/archive/2012/03/17/2404015.html">
                            2. python发送各类邮件的主要方法(100373)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/archive/2012/03/08/2385808.html">
                            3. Python shutil模块(77247)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/p/4012069.html">
                            4. 树莓派学习笔记（3）：利用VNC远程控制树莓派(64914)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/p/4214271.html">
                            5. opencv-python 学习笔记1：简单的图片处理(62903)
                        </a>
                    </li>
        </ul>
    </div>
</div>
</div>

<!-- 评论排行榜 -->
<div id="sidebar_topcommentedposts" class="sidebar-block">
    
<div id="topfeedback_posts_wrap">
    <h3 class="catListTitle">评论排行榜</h3>
    <div id="TopFeedbackPostsBlock">
        <ul style="word-break:break-all">
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/p/7092673.html">
                            1. 利用单片机快速实现家庭智能控制平台(38)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/archive/2012/03/17/2404015.html">
                            2. python发送各类邮件的主要方法(27)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/p/4355161.html">
                            3. 利用 ProtoThreads实现Arduino多线程处理（2）(21)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/p/4051238.html">
                            4. 树莓派学习笔记（5）：成功实现NAS家庭服务器（流媒体播放、文件共享及下载机）(21)
                        </a>
                    </li>
                    <li>
                        <a href="https://www.cnblogs.com/xiaowuyi/archive/2012/11/15/2771099.html">
                            5. python网络编程学习笔记（10）：webpy框架(18)
                        </a>
                    </li>
        </ul>
    </div>
</div>
</div>

<!-- 推荐排行榜 -->
<div id="sidebar_topdiggedposts" class="sidebar-block">
    
<div id="topdigg_posts_wrap">
    <div class="catListView">
        <h3 class="catListTitle">推荐排行榜</h3>
        <div id="TopDiggPostsBlock">
            <ul style="word-break: break-all">
                        <li>
                            <a href="https://www.cnblogs.com/xiaowuyi/p/7092673.html">
                                1. 利用单片机快速实现家庭智能控制平台(46)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/xiaowuyi/p/4051238.html">
                                2. 树莓派学习笔记（5）：成功实现NAS家庭服务器（流媒体播放、文件共享及下载机）(10)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/xiaowuyi/p/6980072.html">
                                3. 邪恶改装：TPYBoard制作廉价WIFI干扰器(9)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/xiaowuyi/archive/2012/11/15/2771099.html">
                                4. python网络编程学习笔记（10）：webpy框架(7)
                            </a>
                        </li>
                        <li>
                            <a href="https://www.cnblogs.com/xiaowuyi/p/7110652.html">
                                5. 邪恶改装2：用单片机实现一次简单的wifi密码欺骗(7)
                            </a>
                        </li>
            </ul>
        </div>
    </div>
</div>
</div></div>
                    <script>loadBlogSideColumn();</script>
                    <!-- end:  SingleColumn -->
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
    <div id="footer">
        <!--done-->
Copyright © 2019 小五义
<br><span id="poweredby">Powered by .NET Core 3.1.0 on Linux</span>

    </div>
</div>

    <div id="page_end_html">
        <script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fb43f47b101789ba010b16dd6cf82f01b' type='text/javascript'%3E%3C/script%3E"));
</script><script src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/h.js.下载" type="text/javascript"></script><a href="http://tongji.baidu.com/hm-web/welcome/ico?s=b43f47b101789ba010b16dd6cf82f01b" target="_blank"><img border="0" src="./Arduino入门笔记（4）：用蜂鸣器演奏音乐并配有LED闪烁 - 小五义 - 博客园_files/21.gif" width="20" height="20"></a>
    </div>


</body></html>